<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>dom对象</title>
</head>
<body>
<h3>*uce</h3>
<div class = "uce"></div>
<h3>duce</h3>
<div class="duce"></div>
<script>
    //  querySelector获取dom元素
    function getUce(){
     const li = ["sauce","saucer","lettuce","letter","truce","armistice","ceasefire"]
     let random = Math.floor(Math.random()*li.length)
     const uce = document.querySelector(".uce")
     uce.innerText = li[random]
    }
    // querySelectorAll获取dom元素
    function getDuce(){
        const li = ["induce","seduce","reduce","adduce","cite","traduce","slander",
                    "deduct","deductible","deduce","deduction","deductive","produce"]
        let random = Math.floor(Math.random()*li.length)
        const duce = document.querySelectorAll(".duce")
        duce[0].innerText = li[random]
    }
    setInterval(getUce,500)
    setInterval(getDuce,500)
</script>
</body>
</html>